﻿using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MiData
{
    public struct ConnInfo
    {
        public string user;
        public string pass;
        public string server;
        public string port;
        public string charset;
        public string dataBase;
        public string type;
        public string playlogDB;
    }

    public class DBComponent
    {
        
        public static void Init(ConnInfo info)
        {
            MySqlConnectionStringBuilder s = new MySqlConnectionStringBuilder();
            s.Server = info.server;
            s.UserID = info.user;
            s.Password = info.pass;
            s.Database = info.dataBase;
            s.CharacterSet = info.charset;

            //MiData.DBAdapterUtils.DBAdapter = new MiData.MysqlMiDBAdapter(s.ToString());

        }

        /// <summary>
        /// 能过Info，生成mysql的字符串
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public static string MysqlStringBuilder(ConnInfo info)
        {
            MySqlConnectionStringBuilder s = new MySqlConnectionStringBuilder();
            s.Server = info.server;
            s.UserID = info.user;
            s.Password = info.pass;
            s.Database = info.dataBase;
            s.CharacterSet = info.charset;
            return s.ToString();
        }
    }
}
